			function getXmlHttpObject(){
				var xmlHttpRequest;
				if(window.ActiveXObject){
					//window.alert("ie");
				}else{
					//window.alert("firefox");
					xmlHttpRequest=new XMLHttpRequest();
				}
				return xmlHttpRequest;
			}
			
			var myXmlHttpRequest;
			var post;var username; var password;
			function checkName(){
				myXmlHttpRequest=getXmlHttpObject();
				checkpost();
				username=document.getElementById("username").value;
				password=document.getElementById("password").value;
				if(myXmlHttpRequest){
					var url="http://localhost:8080/StuScoreSystem/Login?method="+post+"Login&&username="+username+"&&password="+password+"";
					//var url="http://localhost:8080/StuScoreSystem/Login?method=adminLogin&&username=admin&&password=123";
					myXmlHttpRequest.open("get",url,true);
					myXmlHttpRequest.onreadystatechange=progress;
					myXmlHttpRequest.send(null);
				}
		
				else{
					window.alert("error");
				}
			}
	
			function progress(){
				if(myXmlHttpRequest.readyState==4){
					var json=myXmlHttpRequest.responseText;
					var json_obj=eval("("+json+")");
					//var json1=JSON.parse(json);
					var state_obj=json_obj.meta;
					if(state_obj.state=="success"){
						if(post=="admin"){
							window.location.href="index.html?username="+username+"";
						}
						else if(post=="teacher"){
							window.location.href="teacher_info.html?username="+username+""
						}
						else{
							window.location.href="studentMain.html?username="+username+"";
						}
					}
					else{
						window.alert("用户名或密码错误");
					}
				}
			}
			
			function checkpost(){
				var obj=document.getElementById("selector");
				var index=obj.selectedIndex;
				post=obj.options[index].text;
			}
			